#include <iostream>
using namespace std;

int main(void)
{
    string s;
    char c;
    cin >> s >> c;

    int n= 0;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i] == c)
            n++;
    }
    cout << n << endl;
}